//
//  ExpertDetailBtnCell.m
//  DaJiang
//
//  Created by sally on 16/10/9.
//  Copyright © 2016年 jiniu. All rights reserved.
//

#import "ExpertDetailBtnCell.h"
#import "CommentListViewController.h"

@interface ExpertDetailBtnCell ()

@property (weak, nonatomic) IBOutlet UIButton *actionBtn;

@end

@implementation ExpertDetailBtnCell

- (void)awakeFromNib {
  [self initControl];
}

- (void)initControl {
  self.actionBtn.layer.borderWidth = 1;
  self.actionBtn.layer.borderColor = GOrangeColor.CGColor;
  self.actionBtn.layer.cornerRadius = self.actionBtn.height / 2;
  self.actionBtn.layer.masksToBounds = YES;
}

- (void)setBtnType:(ExpertDetailBtnType)btnType {
  _btnType = btnType;
  //设置数据后，才装配控件

  if (self.btnType == ExpertDetailBtnType_Desc) { //关于专家-显示全部
    [self.actionBtn setTitle:@"显示全部" forState:UIControlStateNormal];
  } else {
    [self.actionBtn setTitle:@"显示全部评论" forState:UIControlStateNormal];
  }
}

- (IBAction)actionOnMore:(id)sender {
  if (self.btnType == ExpertDetailBtnType_Desc) { //关于专家-显示全部
    if (self.delegate && [self.delegate respondsToSelector:@selector(goToMore)]) {
      [self.delegate goToMore];
    }
  } else {
    CommentListViewController *vc = [[CommentListViewController alloc]init];
    vc.expertId = self.expertId;
    [[[CommonMethod sharedCommonMethod]getCurrNavController]pushViewController:vc animated:YES];
  }
}

@end
